<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        var a = 8
        function test() {
            console.log(a)
            a = 10
            console.log(a)
        }
        test()
        console.log(a)

        var arr = [{ code: 1, name: 1, kk: 1 }, { code: 2, name: 2, kk: 2 }, { code: 2, name: 2, kk: 2 }]
        let arr1 = arr.map(item => ({
            code: item.code,
            name: item.name
        }))
        // arr.forEach(item => {
        //     delete item.kk
        // })

        console.log(arr1)
    </script>
</body>

</html>